package com.zr.inquiry.spare.service.impl;

import com.zr.inquiry.spare.mapper.SpareMapper;
import com.zr.inquiry.spare.model.pojo.QueryPageSelectMaterialVo;
import com.zr.inquiry.spare.service.SpareService;
import com.zr.utils.page.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName SpareServiceImpl
 * @Description TODO
 * @Author Jiakui_Ma
 * @Date 2019/11/15 15:31
 */
@Service
public class SpareServiceImpl implements SpareService {

    @Autowired
    PageUtil<QueryPageSelectMaterialVo> page;

    @Autowired
    private SpareMapper spareMapper;
    @Override
    public PageUtil<QueryPageSelectMaterialVo> selectMaterial(QueryPageSelectMaterialVo materialVo) {

        page.setPageIndex(materialVo.getPageIndex());
        page.setTotalNumber(spareMapper.getCount(materialVo));

        page.setDataList(spareMapper.getCurrentPageData(materialVo));

        return page;
    }
}
